<?php

namespace common\models;

use Yii;
use common\models\ResourceModel;

/**
 * This is the model class for table "resrelationknow".
 *
 * @property integer $id
 * @property string $knowid
 * @property string $resid
 * @property double $weight
 * @property string $userid
 */
class ResrelationknowModel extends \yii\db\ActiveRecord
{
    /**
     * @inheritdoc
     */
    public $keywords;


    public static function tableName()
    {
        return 'resrelationknow';
    }

    /**
     * @inheritdoc
     */
    public function rules()
    {
        return [
            [['weight'], 'number'],
            [['knowid', 'resid', 'userid'], 'string', 'max' => 255],
        ];
    }

    /**
     * @inheritdoc
     */
    public function attributeLabels()
    {
        return [
            'id' => 'ID',
            'knowid' => 'Knowid',
            'resid' => 'Resid',
            'weight' => 'Weight',
            'userid' => 'Userid',
            'keywords'=>'关键字',
        ];
    }
    
    public function getResource()
    {
        return $this->hasOne(ResourceModel::className(), ['id'=>'resid']);
    }
}
